//
//  ViewController.m
//  NSNotificationAndDelegateAndKVO
//
//  Created by hyl on 16/6/6.
//  Copyright © 2016年 hyl. All rights reserved.
//

#import "ViewController.h"
#import "HYLFooterXib.h"
#import "HYLPerson.h"
@interface ViewController () <HYLFooterXibDelegate>
@property (nonatomic,strong) HYLPerson *p;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    HYLFooterXib *footerXib=[HYLFooterXib footerXib];
    footerXib.frame=CGRectMake(50, 50, 200, 44);
    //footerXib.backgroundColor=[UIColor redColor];
    [self.view addSubview:footerXib];
    footerXib.delegate=self;
    self.p=[[HYLPerson alloc]init];
    self.p.name=@"xx";
    [self.p addObserver:self forKeyPath:@"name" options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew) context:nil];
    self.p.name=@"sss";
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadMoreDidClick:) name:@"loadMoreDidClick" object:nil];
}
#pragma mark - NSNotificationCenter
-(void) loadMoreDidClick:(NSNotification *) note{
    NSLog(@"nsnotification");
}
#pragma mark - HYLFooterXibDelegate
-(void)footerXibDidClickLoadMore:(HYLFooterXib *)footerXib{
    NSLog(@"obser");
    
}
#pragma mark - KVO
-(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{
    NSLog(@"%@  - %@  -%@",object,change,keyPath);
}
@end
